

const http = require("http")

const fs = require("fs")

const revers = http.createServer((req, res) => {

    let url = req.url
    if (url === "/favicon.ico") {
        res.end('404')
        return
    }

    // if (url === "/") {
    //     let str1 = fs.readFileSync("./index.html")
    //     res.end(str1)
    //     return
    // }
    if(url === "/"){
        url = "/index.html"
    }

    let str = fs.readFileSync(__dirname + url)
    res.end(str)
})

revers.listen(80, () => {
    console.log("进入了");
})

